<template>
  <div>
    <h2>我是哥哥,我开的车是{{ car }}</h2>
    <button @click="changeCar">赚钱了,换车</button>
  </div>
</template>

<script>
import PubSub from "pubsub-js";
export default {
  name: "Gege",
  data() {
    return {
      car: "八手奥托",
    };
  },
  methods: {
    changeCar() {
      this.car = "奥迪A8";
      PubSub.publish("getCar", this.car);
    },
  },
};
</script>

<style>
</style>